Generational Garbage Collection for Lazy Functional Languages without Temporary Space Leaks

نویسنده

  • Niklas Röjemo
چکیده

Generational garbage collection is an established method for creating eecient garbage collectors. Even a simple implementation where all nodes that survive one garbage collection are tenured, i.e., moved to an old generation, works well in strict languages. In a lazy language, however, such an implementation can create severe temporary space leaks. The temporary space leaks appear in programs that traverse large lazily built data structures, e.g., a lazy list representing a large le, where only a small part is needed at any time. A simple generational garbage collector can not reclaim the memory, used by the lazily built list, at minor collections. The reason is that at least one of the nodes in the list belongs to the old generation, after the rst minor collection, and will hold on to the rest of the nodes in the list until the next major collection takes place. To completely abandon the idea with generational garbage collection for lazy languages is however an overkill since the fundamental idea behind generational garbage collection, that the mortality of young nodes are higher than for old nodes, is valid also for lazy languages. Implementations of lazy languages create large amount of short lived nodes that represent suspended computations. A generational garbage collector concentrates on these young nodes, which have high mortality, and can therefore reclaim more memory with less work compared to a non-generational collector. This paper describes a generational garbage collector that avoids many of the temporary space leaks introduced by a simple generational collector. The main diierences between this generational collector and other generational collectors are; that no test is needed before updating nodes, and the way ageing of nodes are handled. The latter makes it very easy to have diierent tenure policy for nodes with diierent types. The former makes it possible to change between non-generational and generational garbage collection at runtime. This is an advantage as the choice of garbage collector often depends on the amount of memory available when runing the program. The garbage collector is implemented for the Chalmers LML/Haskell compiler, and is compared with the original two-space copying garbage collector and a simple generational garbage collector that tenures all nodes that survive one collection.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Generational Garbage Collection without Temporary Space Leaks for Lazy Functional Languages

Generational garbage collection is an established method for creating eecient garbage collectors. Even a simple implementation where all nodes that survive one garbage collection are tenured, i.e., moved to an old generation , works well in strict languages. In lazy languages, however, such an implementation can create severe temporary space leaks. The temporary space leaks appear in programs t...

متن کامل

Fixing some Space Leaks with a Garbage Collector

Some functional programs may use more space than would be expected. A modiication to the garbage collector is suggested which solves this problem in some cases. Related work is discussed. A \space leak" is a feature of a program that causes it to use more space than one would expect. Several researchers have pointed out that space leaks are a common problem in functional languages with lazy eva...

متن کامل

Estimating the Cost of Native Method Calls for Resource-bounded Functional Programming Languages

We address the problem of applying resource-bounded functional programming languages in practice on object-oriented virtual machines which include calls to native methods coded in low-level languages without garbage collection support. We consider the application of a functional language with a high-level type system which incorporates measures of heap space consumption in types on such an exec...

متن کامل

Garbage Collection, and Memory Eeciency, in Lazy Functional Languages Garbage Collection Recycling Memory

Introduction These introductions normally start with how great lazy functional languages are, how their mathematical purity makes proving the program correct easier, and how easy it is to code up diicult algorithms in a simple manner. They rarely talk about memory management. This is because this is a problem area for lazy functional languages.. The above is a paraphrase of Sin92]. 1 Although o...

متن کامل

Space Improvements and Equivalences in a Functional Core Language

We explore space improvements in LRP, a polymorphically typed call-by-need functional core language. A relaxed space measure is chosen for the maximal size usage during an evaluation. It abstracts from the details of the implementation via abstract machines, but it takes garbage collection into account and thus can be seen as a realistic approximation of space usage. The results are: a context ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995